# main source file

.org 0x10000000
j start
nop

.include combat_engine.asm
.include rand_gen.asm
.include libplp_uart.asm
.include phase_zero.asm
.include phase_one.asm
.include deaths.asm
.include phase_two.asm
.include phase_three.asm
.include Phase2Meta.asm
.include phase2front.asm
.include Phase2EX.asm
.include hazardsphase2.asm
.include phase2test.asm
.include phase3doc.asm
.include demo1.asm
.include BossEncounterTempDELETE.asm


welcome:
.asciiz "\nWould you like to play a game? \n"

yunostr:
.asciiz "\nYour advisor says you have to take this class. Let's play Comp Arch."

sureplay:
.asciiz "\nWhat would you like to play?\n1. Chess\n2. Tic Tac Toe\n3. Global Thermonuclear War\n4. Comp Arch"

chess:
.asciiz "\nThat's boring, pick another game."
tictactoe:
.asciiz "\nI've already won, pick another game."
wargames:
.asciiz "\nThe only winning move is not to play. Therefore, I choose not to play... and I win."
comparch:
.asciiz "\nYou sign up for class. Three months later..."

start:
#debug
# j research
nop

#li $sp, 0x10fffffc
li $a0, welcome
jal libplp_uart_write_string
nop

jal libplp_uart_read
nop

move $a0, $v0
jal libplp_uart_write
nop
# temporarily store user input
j yesno_compare
nop

yesno_compare:
li $a1, 0x0079
bne $a0, $a1, yuno
nop
j sure
nop

sure:
li $a0, sureplay
jal libplp_uart_write_string
nop
jal libplp_uart_read
nop
j select_game
nop

yuno:
li $a0, yunostr
jal libplp_uart_write_string
nop
j phase_zero_begin
nop

select_game:
	# if the user selects 1
	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, game_one
	nop
	# if the user selects 2
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, game_two
	nop
	# if the user selects 3
	move $t0, $v0
	li $t1, 0x00000033
	beq $t0, $t1, game_three
	nop
	# if the user selects 4
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, game_four
	nop
	
game_one:
	li $a0, chess
	jal libplp_uart_write_string
	nop
	j start
	nop
game_two:
	li $a0, tictactoe
	jal libplp_uart_write_string
	nop
	j start
	nop
game_three:
	li $a0, wargames
	jal libplp_uart_write_string
	nop
	j start
	nop
# OMG THEY PICKED OUR GAME
game_four:
	li $a0, comparch
	jal libplp_uart_write_string
	nop
	j phase_zero_begin
	nop
	
	